import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
const app = createApp(App)

import 'element-plus/lib/theme-chalk/index.css'

import { ElMessage } from 'element-plus'
import ElementPlus from 'element-plus'
app.config.globalProperties.$ElMessage = ElMessage
app.use(ElementPlus)

import { http, hloading } from './lib/utils-http'
app.config.globalProperties.$http = http
app.config.globalProperties.$default_hloading = hloading

// import _ from 'lodash'
// app.config.globalProperties.$_ = fun => _.debounce(fun, 5000)


import { CONF } from './lib/config'
import DeviceType1 from '@/views/web/DeviceType1.vue'
import DeviceType2 from '@/views/web/DeviceType2.vue'
import SessionKey from '@/views/web/SessionKey.vue'
import NetConfig from '@/views/web/NetConfig.vue'
import Logger from '@/views/web/Logger.vue'
import WorkWay from '@/views/web/WorkWay.vue'


import Activate from '@/views/client/Activate.vue'
import ActivateStep from '@/views/client/ActivateStep.vue'
import ActStep from './views/client/ActStep.vue';
import NetConfiguration from './views/client/NetConfiguration.vue'
import TestClient from './views/client/TestClient.vue'
import UpdateKey from "./views/client/UpdateKey.vue"

import CpyName from '@/views/CpyName.vue'
app.component("CpyName",CpyName)
if (CONF.BSType == 'webserver') {
    app.component('DeviceType1', DeviceType1)
    app.component('DeviceType2', DeviceType2)
    app.component('SessionKey', SessionKey)
    app.component('NetConfig', NetConfig)
    app.component('Logger', Logger)
    app.component('WorkWay', WorkWay)
}
    
if (CONF.BSType == 'client'){
    app.component('Activate', Activate)
    app.component('ActivateStep', ActivateStep)
    app.component('ActStep', ActStep)
    app.component('UpdateKey', UpdateKey)
    app.component('NetConfiguration', NetConfiguration)
    app.component('TestClient', TestClient)
}


import { main_menu, icon, iconLayer, iconText, naive, userInfo } from './lib/utils-global'
app.config.globalProperties.$mainMenu = main_menu
app.config.globalProperties.$userInfo = userInfo

// console.log("---------main.js-------------")
// const process = require('process')
// const env = import.meta.env
// console.log(env)


app.component('icon', icon)
    .component('icon-layer', iconLayer)
    .component('icon-text', iconText)
    .use(router).use(naive).mount('#app')
